package com.can.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.can.domain.Dto.CreatePostDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@TableName("posts")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class post {

  private int id;
  private int sectionId;
  private int userId;
  private String title;
  private String content;
//  private java.sql.Timestamp createdAt;
private   String createdAt;

  private String username;


public post dtoToEntity(int userId, CreatePostDto dto) {
  post post = new post();
  post.setTitle(dto.getTitle());
  post.setContent(dto.getContent());
  post.setSectionId(dto.getSectionId());
  post.setUserId(userId);
  post.setUsername(dto.getUsername());
  return post;
}


}
